<template>
  <template v-if="isPrimitive(body)">{{ body }}</template>
  <LowCode v-else-if="isPlainObj(body)" :schema="body" />
  <template v-if="Array.isArray(body)">
    <LowCode :schema="item" v-for="(item, index) in body" :key="item?.key || index" />
  </template>
</template>

<script setup>
import { isPrimitive, isPlainObj } from '@/utils/index'
import LowCode from '@/components/LowCode.vue'

defineOptions({ name: 'BodyCom' })

defineProps({
  body: [String, Number, Object, Array]
})
</script>
